package com.sunseaypw.springmvc.web;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.context.support.WebApplicationContextUtils;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

/**
 * 切记控制器不要设置类属性，因为需要考虑线程安全，只使用方法局部变量和参数变量！！
 */
public class HelloController implements Controller {
    public ModelAndView handleRequest(HttpServletRequest arg0, HttpServletResponse arg1)
       throws java.lang.Exception{
           var wac=WebApplicationContextUtils.getWebApplicationContext(arg0.getServletContext());   
           //var mmm=wac.getBean("mmm");
           var mv=new ModelAndView();
           mv.setViewName("fileop.html");
           return mv;
       }
}
